s = "abc", k = 2


function solution(s, k) {
    let Hash = {
        a: 'bc',
        b: 'ca',
        c: 'ab'
    }

    while (k > 0) {
        let len = s.length
        let mid = ''
        for (let i = 0; i < len; i++) {
            mid = mid + Hash[s[i]]
        }
        s = mid
        k--
    }
    return s
}
console.log(solution(s, k));
